package com.pmpd.activity.constants;

import java.util.Map;
import java.util.WeakHashMap;

/**
 * \* User: helei
 * \* Date: 18/05/18
 * \* Description:
 * \
 */
public class ActivityConstant {
    private ActivityConstant() {
    }

    /**
     * Activity模块的错误以29开头
     */
    public static final Integer RESPONSE_ACTIVITY_USABLE_ERROR_CODE = 29001;
    public static final String RESPONSE_ACTIVITY_USABLE_ERROR_MSG = "上架状态的热门活动不能编辑和删除";
    public static final Integer RESPONSE_NOT_IN_APPLY_TIME_ERROR_CODE = 29002;
    public static final String RESPONSE_NOT_IN_APPLY_TIME_ERROR_MSG = "不在报名时间内";
    public static final Integer RESPONSE_DATA_PARSE_ERROR_CODE = 29003;
    public static final String RESPONSE_DATA_PARSE_ERROR_MSG = "数据解析错误";
    public static final Integer RESPONSE_DATA_SYNCHRONOUS_ERROR_CODE = 29004;
    public static final String RESPONSE_DATA_SYNCHRONOUS_ERROR_MSG = "数据同步失败";
    public static final Integer RESPONSE_RPC_GET_DATA_ERROR_CODE = 29005;
    public static final String RESPONSE_RPC_GET_DATA_ERROR_MSG = "RPC调用数据失败";
    public static final Integer RESPONSE_JOIN_ACTIVITY_ERROR_CODE = 29006;
    public static final String RESPONSE_JOIN_ACTIVITY_ERROR_MSG = "已加入活动，类型为";
    public static final Integer RESPONSE_NO_DATA_ERROR_CODE = 29007;
    public static final String RESPONSE_NO_DATA_ERROR_MSG = "无数据";
    public static final Integer RESPONSE_REDIS_INSERT_ERROR_CODE = 29008;
    public static final String RESPONSE_REDIS_INSERT_ERROR_MSG = "缓存新增数据错误";

    public static final Integer DEFAULT_API_MAX_PAGE_SIZE = 5;//app热门活动最多显示5条

    public static final Integer ACTIVITY_USABLE = 1;//1上架（默认），2下架
    public static final Integer ACTIVITY_UNUSABLE = 2;

    public static final Integer ACTIVITY_STATUS_UNUSABLE = 1;//1未上架， 2未开始， 3已结束, 4进行中
    public static final Integer ACTIVITY_STATUS_NOT_START = 2;
    public static final Integer ACTIVITY_STATUS_FINISHED = 3;
    public static final Integer ACTIVITY_STATUS_ON_GOING = 4;

    public static final String DEFAULT_ORDER_BY_CLAUSE = " priority asc, update_time desc";
    public static final String UPDATE_TIME = " update_time";//最后更新时间
    public static final String DESC = " desc";

    public static final String SORT_BY_PROJECT_NAME = "projectName";//App名称 projectName

    private static final Map<String, String> orderByClauseMap = new WeakHashMap<>();

    static {
        orderByClauseMap.put("title", " title");//标题
        orderByClauseMap.put("usable", " usable");//上架
        orderByClauseMap.put("priority", " priority");//优先级
        orderByClauseMap.put("readNumber", " read_number");//阅读数量
        orderByClauseMap.put("beginTime", " begin_time");//开始时间
        orderByClauseMap.put("endTime", " end_time");//结束时间
    }

    private static final Map<Integer, String> orderByClauseSequenceMap = new WeakHashMap<>();

    static {
        orderByClauseSequenceMap.put(0, " asc");//0 asc正序, 1 desc倒序
        orderByClauseSequenceMap.put(1, DESC);
    }

    public static Map<String, String> getOrderByClauseMap() {
        return orderByClauseMap;
    }

    public static Map<Integer, String> getOrderByClauseSequenceMap() {
        return orderByClauseSequenceMap;
    }

    /** 七天养成计划数据 **/
    public static final Integer USER_PARTICIPATION_DAYS = 7; //用户能参与活动的天数
    public static final Long TIME_FORECAST_BEGIN = 1528560000L; //预告开始时间(2018/6/10 00:00:00)
    public static final Long TIME_ACTIVITY_BEGIN = 1530806400L; //预告结束时间、用户报名开始时间、活动开始时间(2018/7/6 00:00:00)
    public static final Long TIME_USER_APPLY_END = 1531065600L; //用户报名结束时间(2018/7/9 00:00:00)
    public static final Long TIME_ACTIVITY_END = 1531670400L; //活动结束时间、中奖公布开始时间(2018/7/16 00:00:00)
    public static final Long TIME_WINNING_END = 1531756800L; //中奖公布结束时间(2018/7/17 00:00:00)
    public static final int TIMER_TASK_INSERT_HOUR_OF_DAY = 23; //定时任务小时数
    public static final int TASK_JUDGE_HOUR_OF_DAY = 21; //判定用户当天开始或第二天开始任务小时数

    /** 用户中奖状态 **/
    public static final int STATE_JOIN_WINNING = 2; //用户状态为参与抽奖
    public static final int STATE_WINNING = 3; //用户状态为已中奖

    /** 用户进程状态 **/
    public static final int STATE_PROGRESS_NOT_COMPLETE = 1; //未完成
    public static final int STATE_PROGRESS_NOT_QUALIFIED = 2; //未达标
    public static final int STATE_PROGRESS_COMPLETE = 3; //完成

    public static final double QUALIFIED_PROPORTION = 0.5; //计步、睡眠和跑步数据达标的比例

    /** 活动设置任务的默认值 **/
    public static final long SEVEN_DAYS_TRAINING_ID = 11; //七天养成计划活动id
    public static final int DEFAULT_REMIND_TIME = 3600 * 17; //任务提醒时间（17:00）
    public static final int DEFAULT_REMIND = 1; //提醒状态（提醒）
    public static final int DEFAULT_LEVEL = 3; //紧急程度（重要）
    public static final int DEFAULT_REPEAT_NUMBER = 0; //重复（永不）
    public static final int DEFAULT_REPEAT_TYPE = 0; //下拉列表（永不）
    public static final int DEFAULT_STATUS = 2; //是否完成（未完成）

    public static final int STATE_STEP = 1; //计步数据
    public static final int STATE_SLEEP = 2; //睡眠数据

    public static final int LENGTH_RUN_TASK_COMMENT_SPLITE = 2; //七日养成计划中跑步任务字符串被分割的段数
    public static final int LENGTH_STEP_TASK_COMMENT_SPLITE = 3; //七日养成计划中计步睡眠任务字符串被分割的段数

    /** 定时任务相关值 **/
    public static final String EMAIL_ADDRESS = "liuying@smartmovt.com"; //定时任务反馈信息邮箱
    public static final String EMAIL_SUBJECT = "七天养成计划定时任务"; //定时任务反馈信息标题
}